/**
 * 认证接口测试用例入口
 *
 * Created by snowingsea on 2020/01/22.
 */
const health = require('./../../models/health');
const Administrator = require('./../../models/administrator');

/**
 * Export model definition object.
 */
module.exports = describe('Test OAuth2.0', function () {
  const administrator = new Administrator();
  const newUserIds = [];

  before(function (done) {
    let user;
    health.ping()
      .then(() => administrator.createRandomTester())
      .then((tester) => {
        user = tester;
        newUserIds.push(user.userId);
        return user.login();
      })
      .then(() => user.logout())
      .then(() => {
        done();
      })
      .catch(done);
  });
  after(function (done) {
    administrator.removeUsers(newUserIds)
      .then(() => {
        done();
      })
      .catch(done);
  });

  require('./get-access-token.test');
  // require('./refresh-access-token.test');
});
